package com.ssm.entity;

import java.util.Calendar;
import java.util.Date;

public class User extends  Base {

    private String loginName;
    private String userName;
    private String password;
    private String sex;
    private Date birthday;
    private Integer age;
    private Integer roleId;
    private String roleName;
    private String code;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public Integer getRoleId() {
        return roleId;
    }

    public void setRoleId(Integer roleId) {
        this.roleId = roleId;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Date getBirthday() {
        return birthday;
    }

    public Integer getAge() {
        Calendar c = Calendar.getInstance();
        int nowYear = c.get(Calendar.YEAR);
        c.setTime(this.birthday);
        int birYear = c.get(Calendar.YEAR);
        return nowYear - birYear;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
}
